package com.lovo.ssc.service.impl;

import com.lovo.sscweb.dto.MoneyDto;
import com.lovo.util.MQUtil;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.net.InetAddress;

@Service
public class MoneyTest {

//    @RabbitListener(queues = MQUtil.moneyQueue)
//    public void TestReceive(Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag, MoneyDto moneyDto) throws IOException {
//        String localIP= InetAddress.getLocalHost().getHostAddress();
//        System.out.println(localIP+"本地ip");
//        System.out.println(moneyDto.getIp()+"dto的ip");
//        if (moneyDto.getIp().equals(localIP)){
//            System.out.println("ip正确进入");
//            System.out.println(moneyDto);
//            channel.basicAck(tag,true);
//        }
//    }
}
